home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Night Owl 6
/
Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso
/
027a
/
clipio.zip
/
BLAKBOOK.PRG
< prev
next >
Wrap
Text File
|
1990-06-23
|
22KB
|
741 lines
reindex = (pcount() > 0)
restore from blakbook.mem additive
if !iscolor()
_c_addr_en = 112
_c_fami_en = 112
_c_memb_en = 112
_c_menu_en = 112
_c_addr_st = 7
_c_fami_st = 7
_c_memb_st = 7
_c_menu_st = 7
_c_addr_un = 1
_c_fami_un = 1
_c_memb_un = 1
_c_menu_un = 112
_c_fram = 7
_c_help = 7
_c_hlpk = 112
_c_note = 7
_c_wind_en = 7
_c_wind_st = 112
_c_wind_un = 1
endif
* SET up
set scoreboard off
vsetcursor(.f.)
readexit(.f.)
setcancel(.f.)
private main[12], print[6], system[4]
private ffields[2], fpics[2], mfields[5], mpics[5], ekeys[5], edesc[5]
private appending, ctrlsaved, famictrl, piccount, passclick, passchoice
private findmemb
main[1] = 'Address'
main[2] = 'Call'
main[3] = 'Delete'
main[4] = 'Edit'
main[5] = 'Families'
main[6] = 'Insert'
main[7] = 'Locate'
main[8] = 'Members'
main[9] = 'Notes'
main[10] = 'Print'
main[11] = 'Quit'
main[12] = 'System'
print[1] = 'Address book'
print[2] = 'Anniversary schedule'
print[3] = 'Birthday and anniversary calendar'
print[4] = 'Birthday schedule'
print[5] = 'Envelope'
print[6] = 'Phone book'
system[1] = 'Colors'
system[2] = 'Database maintenance'
system[3] = 'Modem settings'
system[4] = 'Printer control codes'
ffields[1] = [NAME]
ffields[2] = [PHONE]
fpics[1] = [!xxxxxxxxxxxxxx]
fpics[2] = [(999)999-9999]
mfields[1] = [NAME]
mfields[2] = [MINIT]
mfields[3] = [PHONE]
mfields[4] = [BIRTHDAY]
mfields[5] = [ANNIVERS]
mpics[1] = [!xxxxxxxxxxx]
mpics[2] = [!]
mpics[3] = [(999)999-9999]
mpics[4] = [@D]
mpics[5] = [@D]
ekeys[1] = 'F1'
ekeys[2] = chr(27)+'/'+chr(26)
ekeys[3] = chr(24)+'/'+chr(25)
ekeys[4] = 'PgDn'
ekeys[5] = 'ESC'
edesc[1] = 'Help'
edesc[2] = 'Prev/Next char'
edesc[3] = 'Prev/Next field'
edesc[4] = 'Save changes'
edesc[5] = 'Abort changes'
* begin
set key 289 to Free_Memory && alt-F
passclick = .f.
passchoice = 0
vsetstan(_c_fram)
clear
DrawScreen()
* initialize mouse
msetcursor(.t.) &&turn mouse cursor on
msetbutton(.t.) &&turn button-press tracking on
mdefctrl(0, 0, 0, 79, 255) &&define menubar as ctrl code 255
mdefctrl(4, 1, 12, 29, 251)
mdefctrl(4, 33, 12, 78, 252)
mdefctrl(16, 1, 22, 37, 253)
mdefctrl(16, 41, 22, 78, 254)
*** define page up, down, etc. ***
mdefctrl(1, 30, 2, 32, 240)
mdefctrl(3, 30, 4, 32, 239)
mdefctrl(5, 30, 6, 32, 238)
mdefctrl(8, 30, 9, 32, 237)
mdefctrl(10, 30, 11, 32, 236)
mdefctrl(12, 30, 13, 32, 235)
tourguide()
select 0
use MEMBERS
select 0
use FAMILIES
if reindex
blakpack()
endif
select MEMBERS
set index to MEMBUNIQ, MEMBBIRT, MEMBANNI
set filter to (!deleted())
select FAMILIES
set index to FAMINAME, FAMIUNIQ
set filter to (!deleted())
go top
lastrecno = 0
appending = .f.
ctrlsaved = .f.
findmemb = 0
keyinsert(-71)
menuedit(4, 1, 12, '│', ffields, fpics, 'fami_monitor')
return
*--------------------------------FAMI_MONITOR----------------------------------*
function Fami_Monitor
parameters Mode, fld_ptr
private return_val, lastkey, choice, hrow
* begin
return_val = 1
if mode = 0
if !ctrlsaved
famictrl = msavectrl(4, 1, 12, 29)
ctrlsaved = .t.
endif
if recno() <> lastrecno
lastrecno = recno()
dispmembers()
dispaddress()
dispnotes()
endif
elseif mode = 1 .or. mode = 2
tone(100,1)
elseif mode = 3
if prompt(7, -1, 'The address book is empty. You can...', .t., 'Insert', 'Abort') = 'I'
keyinsert(-23)
lastkey = inkey(0)
else
return 0
endif
mode = 4
endif
if mode = 4
lastkey = lastkey()
hrow = row()
vfillattr(hrow, 1, hrow, 29, _c_fami_en)
if ((keyconv(lastkey) >= -50) .and. (keyconv(lastkey) <= -16)) .or.;
((lastkey = 387) .and. (mgetbutton() == 'L ') .and. (mgetctrl() = 255)) .or.;
(passchoice > 0)
do while .t.
if passchoice = 0
choice = showmenu()
else
choice = passchoice
passchoice = 0
vpushstate()
vsetcolor(_c_menu_st, _c_menu_en, _c_menu_un)
menuline(0, 0, 79, main)
vpopstate()
endif
do case
case choice = 10
FamiAddress()
vpopscrn()
case choice = 20
BlakDial()
vpopscrn()
case choice = 30
FamiDel(@return_val)
vpopscrn()
case choice = 40
FamiEd(@return_val)
vpopscrn()
case choice = 50
*** Families ***
vpopscrn()
case choice = 60
FamiAdd()
vpopscrn()
return_val = 2
case choice = 70
FamiFind(@return_val)
vpopscrn()
case choice = 80
BlakMemb()
vpopscrn()
case choice = 90
FamiNote()
vpopscrn()
case (choice > 100) .and. (choice < 110)
BlakPrnt(choice % 10)
vpopscrn()
vpopscrn()
case choice = 110
sys_exit()
case (choice > 120) .and. (choice < 130)
BlakSyst(choice % 10)
vpopscrn()
vpopscrn()
endcase
if passchoice = 0
exit
endif
enddo
elseif (lastkey = 387) .and. (mgetbutton() == 'L ') .and. (mgetctrl() < 255)
if mgetctrl() = 252 &&Members
keyinsert(-50)
passclick = .t.
elseif mgetctrl() = 253 &&Address
keyinsert(-30)
passclick = .t.
elseif mgetctrl() = 254 &&Notes
keyinsert(-49)
passclick = .t.
elseif mgetctrl() = 240
keyinsert(-132)
elseif mgetctrl() = 239
keyinsert(-73)
elseif mgetctrl() = 238
keyinsert(-72)
elseif mgetctrl() = 237
keyinsert(-80)
elseif mgetctrl() = 236
keyinsert(-81)
elseif mgetctrl() = 235
keyinsert(-118)
endif
elseif (lastkey = 13) .or. (lastkey = 25) .or. ((lastkey >= 32) .and. (lastkey <= 255))
vfillattr(hrow, 1, hrow, 29, _c_fami_st)
if (lastkey <> 13)
keyinsert(keyconv(lastkey))
endif
FamiRead(ffields[fld_ptr], fpics[fld_ptr], @return_val)
elseif lastkey = 27
sys_exit()
endif
if recno() <> lastrecno
lastrecno = recno()
dispmembers()
dispaddress()
dispnotes()
endif
vfillattr(hrow, 1, hrow, 29, _c_fami_st)
endif
return return_val
*----------------------------------FAMIREAD------------------------------------*
function FamiRead
parameters fieldname, pic, ret_val
private old_key
* begin
old_key = get_key()
@ row(), col() get &fieldname picture pic
vsetcursor(.t.)
readexit(.t.)
read
readexit(.f.)
vsetcursor(.f.)
if (lastkey() = 5) .or. (lastkey() = 24)
keyinsert(keyconv(lastkey()))
endif
if (.not. old_key == get_key())
ret_val = 2
endif
return ''
*----------------------------------FAMIFIND------------------------------------*
function FamiFind
parameters ret_val
private fnamem, lnamem, old_rec
* begin
old_rec = recno()
lnamem = space(15)
fnamem = space(12)
vsetcolor(_c_wind_st, _c_wind_en, _c_wind_un)
prompt(17, -1, "Enter all or part of name (last, first): " + lnamem + ', ' + fnamem, .f.)
@ row(), col()-29 get lnamem
@ row(), col() say ',' get fnamem
vsetcursor(.t.)
read
vsetcursor(.f.)
vsetcolor(_c_fami_st, _c_fami_en, _c_fami_un)
lnamem = upper(trim(lnamem))
if .not. empty(lnamem)
seek lnamem
if .not. found()
tone(100, 1)
goto old_rec
else
if .not. empty(fnamem)
fnamem = upper(trim(fnamem))
found = .f.
do while (upper(NAME) = lnamem) .and. (.not. found)
select MEMBERS
seek FAMILIES->UNIQUE + fnamem
found = found()
select FAMILIES
if .not. found
skip
endif
enddo
if found
ret_val = 2
keyinsert(-50) &&invoke members
select MEMBERS
findmemb = recno()
select FAMILIES
else
tone(100, 1)
goto old_rec
endif
else
ret_val = 2
endif
endif
endif
vpopscrn()
return ''
*----------------------------------FAMIADD-------------------------------------*
function FamiAdd
parameters ret_val
private new_unique
* begin
set order to 2
go bott
if lastrec() = 0
new_unique = replicate(chr(1), 4)
else
new_unique = inc_uniq(UNIQUE)
endif
set order to 1
append blank
replace UNIQUE with new_unique
ret_val = 2
appending = .t.
keyinsert(-18) &&call edit record by stuffing alt-E
return ''
*----------------------------------FAMIDEL-------------------------------------*
function famidel
parameters ret_val
private row
* begin
row = row()
vfillattr(row, 1, row, 29, _c_fami_en)
if prompt(-1, -1, 'Are you sure that you want to permanently delete this family?', .t., 'Yes', 'No') = 'Y'
ret_val = 2
select MEMBERS
seek FAMILIES->UNIQUE
do while (UNIQUE == FAMILIES->UNIQUE)
delete
skip
enddo
select FAMILIES
DELETE
skip
endif
vfillattr(row, 1, row, 29, _c_fami_st)
return ''
*-----------------------------------FAMIED-------------------------------------*
function FamiEd
parameters ret_val
private old_key, row
* begin
row = row()
old_key = get_key()
@ row,1 get NAME picture fpics[1]
@ row,col() say '│'
@ row,col() get PHONE picture fpics[2]
helpbar(edesc, ekeys)
vsetcursor(.t.)
mpushstate()
msetcursor(.t.)
msetbutton(.t.)
set key 387 to findclick
read
set key 387 to
mpopstate()
vsetcursor(.f.)
vpopscrn()
if (.not. old_key == get_key()) .or. appending
ret_val = 2
endif
if appending
keyinsert(-30)
endif
vfillattr(row, 1, row, 29, _c_fami_st)
return ''
*--------------------------------FAMIADDRESS-----------------------------------*
function FamiAddress
parameters ret_val
private old_key
* begin
mdefctrl(16, 1, 22, 37, 0)
mdefctrl(4, 1, 12, 29, 251)
vsetcolor(_c_addr_st, _c_addr_en, _c_addr_un)
vfillchar(16, 1, 22, 37, 32)
helpbar(edesc, ekeys)
vsetcursor(.t.)
*** activate Alt keys in menubar
set key 302 to altkey
set key 288 to altkey
set key 274 to altkey
set key 289 to altkey
set key 279 to altkey
set key 294 to altkey
set key 306 to altkey
set key 305 to altkey
set key 281 to altkey
set key 272 to altkey
set key 287 to altkey
set key 387 to altkey
piccount = 1
@ 17, 2 get ADDRESS1 picture mpic(ADDRESS1, '!XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
@ 19, 2 get ADDRESS2 picture mpic(ADDRESS2, '!XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
@ 21, 2 get CITY picture mpic(CITY, '!XXXXXXXXXXXXXXXXXXX')
vputstrc(21, 22, ',', _c_addr_st)
@ 21, 24 get STATE picture mpic(STATE, '!!')
@ 21, 27 get ZIP picture mpic(ZIP, '#####-####')
if passclick
passclick = .f.
keyinsert(-131)
endif
read
set key 302 to
set key 288 to
set key 274 to
set key 289 to
set key 279 to
set key 294 to
set key 306 to
set key 305 to
set key 281 to
set key 272 to
set key 287 to
set key 387 to
vsetcursor(.f.)
vpopscrn()
mdefctrl(16, 1, 22, 37, 253)
mrestctrl(4, 1, 12, 29, famictrl)
vsetcolor(_c_fami_st, _c_fami_en, _c_fami_un)
if appending
keyinsert(-50)
endif
return ''
function altkey
parameters callprog, linenum, inputvar
private lcv, ctrl
* begin
if ((lastkey() = 387) .and. (mgetbutton() == 'L ') .and. (mgetctrl() = 255)) .or.;
((keyconv(lastkey()) >= -50) .and. (keyconv(lastkey()) <= -16))
choice = showmenu()
if choice <> 10
passchoice = choice
keyinsert(23)
endif
elseif (lastkey() = 387) .and. (mgetbutton() == 'L ')
if (mgetctrl() > 0) .and. (mgetctrl() < 11)
findclick()
elseif (mgetctrl() = 251) &&families
keyinsert(23)
keyinsert(-131)
passclick = .t.
elseif mgetctrl() = 252 &&Members
keyinsert(23)
keyinsert(-50)
passclick = .t.
elseif mgetctrl() = 254 &&Notes
keyinsert(23)
keyinsert(-49)
endif
endif
return ''
*---------------------------------DISPADDRESS----------------------------------*
function dispaddress
* begin
vputstrc(17, 2, ADDRESS1, _c_addr_un)
vputstrc(19, 2, ADDRESS2, _c_addr_un)
vputstrc(21, 2, CITY, _c_addr_un)
vputstrc(21, 22, ',', _c_addr_st)
vputstrc(21, 24, STATE, _c_addr_un)
vputstrc(21, 27, ZIP, _c_addr_un)
return ''
*----------------------------------FAMINOTE------------------------------------*
function FamiNote
private mkeys[4], mdesc[4]
mkeys[1] = 'Ctrl-B'
mkeys[2] = 'Ctrl-Y'
mkeys[3] = 'Ctrl-W'
mkeys[4] = 'ESC'
mdesc[1] = 'Reformat memo'
mdesc[2] = 'Delete line'
mdesc[3] = 'Exit and save'
mdesc[4] = 'Exit and abort'
* begin
mdefctrl(4, 1, 12, 29, 251)
vsetcolor(_c_addr_st, _c_addr_en, _c_addr_un)
helpbar(mdesc, mkeys)
vsetstan(_c_note)
vsetcursor(.t.)
replace NOTES with memoedit(NOTES, 16, 41, 22, 78, .t., 'memo_monitor')
vsetcursor(.f.)
vpopscrn()
mdefctrl(16, 41, 22, 78, 254)
mrestctrl(4, 1, 12, 29, famictrl)
vsetcolor(_c_fami_st, _c_fami_en, _c_fami_un)
return ''
*-----------------------------------DISPNOTES----------------------------------*
function dispnotes
private row
* begin
vfillchar(16, 41, 22, 78, 32)
for row = 16 to 22
vputstr(row, 41, memoline(NOTES, 38, row - 15, 4, .t.))
next row
return ''
*---------------------------------MEMO_MONITOR---------------------------------*
function memo_monitor
parameters status, line, col
private choice
* begin
if (status = 1 .or. status = 2)
if ((keyconv(lastkey()) >= -50) .and. (keyconv(lastkey()) <= -16))
choice = showmenu()
if choice <> 90
passchoice = choice
return 23
endif
elseif (lastkey() = 387) .and. (mgetbutton() == 'L ')
if mgetctrl() = 251 &&families
keyinsert(-131)
return 23
elseif mgetctrl() = 252 &&Members
keyinsert(-50)
elseif mgetctrl() = 253 &&address
keyinsert(-30)
endif
if ((mgetctrl() > 251) .and. (mgetctrl() <> 254))
passclick = .t.
return 23
endif
endif
endif
return 0
* end
*--------------------------------DISPMEMBERS-----------------------------------*
function DispMembers
private row
* begin
select MEMBERS
vsetcolor(_c_memb_st, _c_memb_en, _c_memb_un)
menuedit(4, 33, 12, '│', mfields, mpics, 'memb_monitor', 'UNIQUE == FAMILIES->UNIQUE', FAMILIES->UNIQUE, '')
vsetcolor(_c_fami_st, _c_fami_en, _c_fami_un)
select FAMILIES
return ''
*---------------------------------DRAWSCREEN-----------------------------------*
function DrawScreen
* begin
vsetstan(_c_fram)
@ 1,0 to 23,79 double
vputstrc(1, 0, '╔═══════════════╤═════════════╤═╤════════════╤═╤═════════════╤════════╤════════╗')
vputstrc(2, 1, ' Last Name │ Home Phone │ │ First Name │M│ Office Phone│Birthday│Annivers')
vputstrc(3, 0, '╟───────────────┼─────────────┤ ├────────────┼─┼─────────────┼────────┼────────╢')
@ 4,30 to 12,30
vputchar(2,31,12,31,'T─────B')
vfillattr(2,31,12,31,_c_menu_st)
@ 4,32 to 12,32
vfillattr(4, 1, 12, 29, _c_fami_st)
vfillattr(4, 33, 12, 78, _c_memb_st)
vputstrc(13, 0,'╠═══════════════╧═════════════╧═╧═════╤╦╤════╧═╧═════════════╧════════╧════════╣')
vputstrc(14, 1, ' Address │║│ Notes, Etc. ')
vputstrc(15, 0,'╟─────────────────────────────────────┤║├──────────────────────────────────────╢')
@ 16,38 to 22,38
@ 16,39 to 22,39 double
@ 16,40 to 22,40
vfillattr(16, 1, 22, 37, _c_addr_st)
vfillattr(16, 41, 22, 78, _c_note)
vputstrc(23, 0,'╚═════════════════════════════════════╧╩╧══════════════════════════════════════╝')
vsetcolor(_c_menu_st, _c_menu_en, _c_menu_un)
menuline(0, 0, 79, main)
vputstrc(24, 0, 'To select, use arrow keys to highlight and press '+chr(17)+'─┘ or press <Alt>-first letter', _c_menu_st)
vsetcolor(_c_fami_st, _c_fami_en, _c_fami_un)
return ''
*----------------------------------SHOWMENU------------------------------------*
function showmenu
private choice
* begin
vpushstate()
vsetcolor(_c_menu_st, _c_menu_en, _c_menu_un)
keyinsert(keyconv(lastkey()))
choice = menubar(0, 0, 79, 10, main, '', '', '', '', '', '', '', '', '', print, '', system)
vpopstate()
return choice
*----------------------------------SYS_EXIT------------------------------------*
function sys_exit
if prompt(7, -1, 'Are you sure that you want to exit BlakBook?', .t., 'Yes', 'No') = 'Y'
vsetstan(7)
clear
vsetcursor(.t.)
quit
endif
return ''
*----------------------------------TOURGUIDE-----------------------------------*
function tourguide
private tourfile, printfile, buffer
begin sequence
if prompt(2, -1, 'Welcome to Blakbook, an electronic phone book written to'+;
' take full advantage of ClipI/O features and demonstrate'+;
' them to you. ClipI/O provides enhanced terminal I/O'+;
' features such as complete mouse support, enhanced video'+;
' support, enhanced keyboard support, and mouse-compatible'+;
' menus and browsers. If after this demo you are interested'+;
' in ClipI/O, feel free to dig around the source code for'+;
' Blakbook. When you purchase the regular version, you are'+;
' licensed to modify/incorporate/distribute this source code.'+;
' The ClipI/O library is only $49.95. If you are interested in'+;
' purchasing a copy, please print out the order form: Appendix C'+;
' in the on-line documentation in CLIPIO.MAN. The library provided'+;
' with this demo works exactly as the regular library, except that'+;
' any programs which make calls to any ClipI/O functions will automatically'+;
' abort after four or five minutes. Thus, you can use the ClipI/O'+;
' functions in your own programs to see if you are interested in purchasing'+;
' the library. In order to better demonstrate the features of ClipI/O, a'+;
' "tour-guide" is available. Would you like to print out the tour-guide?',;
.t., 'Yes', 'No') == 'Y'
tourfile = fopen('tourgide.man', 0)
if tourfile < 0
prompt(-1, -1, 'Could not find tourgide.man. Press any key...', .t.)
break
endif
printfile = fopen('prn', 1)
if printfile < 0
prompt(-1, -1, 'Printer not ready/available. Press any key...', .t.)
break
endif
buffer = space(100)
do while (fread(tourfile, @buffer, 100) = 100)
fwrite(printfile, buffer, 100)
enddo
fwrite(printfile, buffer, 100)
fclose(tourfile)
fclose(printfile)
endif
end sequence
return ''
function freememory